package com.carrara.helloworld;

import java.util.Scanner;

public class calc2 {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		
		String answer;
	
	do {
		
		System.out.println("Please enter a number.");
		
		Scanner number1 = new Scanner(System.in);
		int num1 = number1.nextInt();
		
		System.out.println("Please enter another number.");
		
		Scanner number2 = new Scanner(System.in);
		int num2 = number2.nextInt();
		
		System.out.println("Please enter your operation; 1: Addition, 2: Subtraction, 3: Multiplication, 4: Division");
		
		Scanner operation = new Scanner(System.in);
		int op = operation.nextInt();
		
		if (op == 1)
		{
			System.out.println(addition(num1, num2));
		}
		else if (op == 2)
		{
			System.out.println(subtraction(num1, num2));
		}
		else if (op == 3)
		{
			System.out.println(multiplication(num1, num2));
		}
		else if(op == 4)
		{
			System.out.println(division(num1, num2));
		}
		else
		{
			System.out.println("Invalid.");
		}
		System.out.println("Would you like to calculate again?");
		answer = operation.next();
	
	} while (answer.equalsIgnoreCase("yes"));
	}
	
	
	
		public static int addition(int num1, int num2) {
			return num1 + num2;
			
		}
		
		public static int subtraction(int num1, int num2) {
			return num1 - num2;
		}
		
		public static int multiplication(int num1, int num2) {
			return num1 * num2;
		}

		public static int division(int num1, int num2) {
			return num1 / num2;
		}

}
